#include <iostream>
#include <vector>
#include <cmath>

using namespace std;
typedef pair<int, double> PII;
int n, m;
const int N = 110;
const double INF = 0x3f3f3f3f;
double dist[N];
struct node
{
    double x, y;
} a[N];

double get_num(node& a, node& b)
{
    double x1 = a.x, y1 = a.y, x2 = b.x, y2 = b.y;
    return sqrt((y1 - y2) * (y1 - y2) + (x1 - x2) * (x1 - x2));
}
int s, t;

vector<PII> edges[N];

void bf()
{
    for (int i = 1; i <= n; i++) dist[i] = INF;
    dist[s] = 0;
    for (int i = 1; i < n; i++)
    {
        bool flag = false;
        for (int j = 1; j <= n; j++)
        {
            int u = j;
            for (auto t : edges[u])
            {
                double w = t.second;
                int v = t.first;
                if (dist[u] + w < dist[v])
                {
                    flag = true;
                    dist[v] = dist[u] + w;
                }
            }
        }
        if (!flag) break;
    }

    printf("%.2lf\n", dist[t]);
}

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i].x >> a[i].y;
    cin >> m;
    for (int i = 1; i <= m; i++)
    {
        int x, y;
        cin >> x >> y;
        double c = get_num(a[x], a[y]);
        edges[x].push_back({ y, c });
        edges[y].push_back({ x, c });
    }
    cin >> s >> t;
    bf();
    return 0;
}